package com.atguigu.ssyx.acl.controller;

import com.atguigu.ssyx.mq.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

/**
 * ClassName: IndexController
 * Package: com.atguigu.ssyx.acl.controller
 * Description:
 *
 * @Author Root
 * @Create 2023/9/4 11:30
 * @Version 1.0
 */
@RestController
@RequestMapping("/admin/acl/index")
@Api(tags = "登录接口")
//@CrossOrigin//跨域
public class IndexController {

    /**
     * login登录
     *
     * @return
     */
    @ApiOperation("登录接口")
    @PostMapping("login")
    public Result login() {
        //返回token值
        Map<String, String> map = new HashMap<>();
        map.put("token", "token-admin");
        return Result.ok(map);
    }

    /**
     * getInfo获取信息
     *
     * @return
     */
    @ApiOperation("获取信息接口")
    @GetMapping("info")
    public Result Info() {
        Map<String, String> map = new HashMap<>();
        map.put("name","admin");
        map.put("avatar","https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif");
        return Result.ok(map);
    }

    /**
     * logout退出
     *
     * @return
     */
    @ApiOperation("退出接口")
    @PostMapping("logout")
    public Result logout() {

        return Result.ok(null);
    }
}
